package cn.xydpeng.springframework.core.annotation;

import java.lang.annotation.Annotation;

/**
 * @author xydpeng
 * @version v1.0
 * @date: 2022/10/22
 * @description:
 */
public abstract class AnnotationUtils {

    public static boolean isCandidateClass(Class<?> clazz, Class<? extends Annotation> annotationType) {
        return isCandidateClass(clazz, annotationType.getName());
    }

    public static boolean isCandidateClass(Class<?> clazz, String annotationName) {
        //java原生注解,java原生类和非原生类都有可能携带有
        if (annotationName.startsWith("java.")) {
            return true;
        }
        //过滤掉java原生类
        if (AnnotationsScanner.hasPlainJavaAnnotationsOnly(clazz)) {
            return false;
        }
        return true;
    }

}
